package com.ushine.design.design.c_behavioral_pattern.k_visitor.a_practice;

import java.util.ArrayList;

public class ObjectStructure {
    //定义一个集合存储元素对象
    private ArrayList<Element> list = new ArrayList<Element>();

    //接受访问者的访问操作
    public void accept(Visitor visitor) {
        list.forEach(value -> {
            value.accept(visitor);
        });
    }

    public void addElement(Element element) {
        list.add(element);
    }

    public void remoeElement(Element element) {
        list.remove(element);
    }
}
